import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as actions from '../store/actions/countActions';

function Counter(props) {
  console.log(props);
  return (
    <div>
      <button onClick={() => props.increment_async(5)}>+</button>
      <span>{props.count}</span>
      <button onClick={() => props.decrement(5)}>-</button>
    </div>
  )
}

const mapStateToProps = state => ({
  count: state.count
});

const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);

export default connect(mapStateToProps, mapDispatchToProps)(Counter);